import {configureStore} from "@reduxjs/toolkit";
import {setupListeners} from "@reduxjs/toolkit/query";
import {loginSlice} from "@/store/reducer/login/loginSlice";
import {aiFeedingSlice} from "./reducer/aiFeeding/aiFeedingSlice.tsx";
import {aiFeedingApi} from "./api/aiFeeding/aiFeedingApi.tsx";
import {loginApi} from "@/store/api/login/loginApi";
import useErrorMiddleware from "@/hooks/useErrorMiddleware";
import {aiOriginalityApi, aiOriginalityCommonApi} from "@/store/api/aiOriginality/aiOriginalityApi";
import {aiOriginalitySlice} from "@/store/reducer/aiOriginality/aiOriginalitySlice";
import {aiInnovationApi} from "@/store/api/aiInnovation/aiInnovationApi";
import {aiInnovationSlice} from "@/store/reducer/aiInnovation/aiInnovationSlice";
import {useExplosiveApi} from "@/store/api/useExplosive/useExplosiveApi";
import {useExplosiveSlice} from "@/store/reducer/useExplosive/useExplosiveSlice";
import {explosiveFissionApi} from "@/store/api/explosiveFission/explosiveFissionApi";
import {explosiveFissionSlice} from "@/store/reducer/explosiveFission/explosiveFissionSlice";
import {keywordExplosionApi} from "@/store/api/keywordExplosion/keywordExplosionApi";
import {keywordExplosionSlice} from "@/store/reducer/keywordExplosion/keywordExplosionSlice";
import {morePlatformsApi} from "@/store/api/morePlatforms/morePlatformsApi";
import {morePlatformsSlice} from "@/store/reducer/morePlatforms/morePlatformsSlice";
import {contentManageApi} from "@/store/api/contentManage/contentManageApi";
import {contentManageSlice} from "@/store/reducer/contentManage/contentManageSlice";
import {videoPublishApi} from "@/store/api/videoPublish/videoPublishApi";
import {videoPublishSlice} from "@/store/reducer/videoPublish/videoPublishSlice";
import {videoAndPictrueApi} from "@/store/api/videoAndPictrue/videoAndPictrueApi";
import {homeApi, homeCommonApi} from "@/store/api/home/homeApi";
import {myApi} from "@/store/api/my/myApi";
import {mySlice} from "@/store/reducer/my/mySlice";
import {ossApi} from "@/store/api/oss/ossApi";
import {ossSlice} from "@/store/reducer/oss/ossSlice";

const store = configureStore({

    reducer:{
        [loginApi.reducerPath]:loginApi.reducer,
        [aiOriginalityApi.reducerPath]:aiOriginalityApi.reducer,
        [aiOriginalityCommonApi.reducerPath]:aiOriginalityCommonApi.reducer,
        [aiInnovationApi.reducerPath]:aiInnovationApi.reducer,
        [useExplosiveApi.reducerPath]:useExplosiveApi.reducer,
        [aiFeedingApi.reducerPath]:aiFeedingApi.reducer,
        [explosiveFissionApi.reducerPath]:explosiveFissionApi.reducer,
        [keywordExplosionApi.reducerPath]:keywordExplosionApi.reducer,
        [morePlatformsApi.reducerPath]:morePlatformsApi.reducer,
        [contentManageApi.reducerPath]:contentManageApi.reducer,
        [videoPublishApi.reducerPath]:videoPublishApi.reducer,
        [homeApi.reducerPath]:homeApi.reducer,
        [videoAndPictrueApi.reducerPath]:videoAndPictrueApi.reducer,
        [homeCommonApi.reducerPath]:homeCommonApi.reducer,
        [myApi.reducerPath]:homeCommonApi.reducer,
        [ossApi.reducerPath]:ossApi.reducer,
        aiFeeding:aiFeedingSlice.reducer,
        login:loginSlice.reducer,
        aiOriginality:aiOriginalitySlice.reducer,
        aiInnovation:aiInnovationSlice.reducer,
        useExplosive:useExplosiveSlice.reducer,
        explosiveFission:explosiveFissionSlice.reducer,
        keywordExplosion:keywordExplosionSlice.reducer,
        morePlatforms:morePlatformsSlice.reducer,
        contentManage:contentManageSlice.reducer,
        videoPublish:videoPublishSlice.reducer,
        my:mySlice.reducer,
        oss:ossSlice.reducer,
    },

    middleware:(getDefaultMiddleware) =>
        getDefaultMiddleware().concat(
            useErrorMiddleware,
            loginApi.middleware,
            aiOriginalityApi.middleware,
            aiOriginalityCommonApi.middleware,
            aiInnovationApi.middleware,
            useExplosiveApi.middleware,
            aiFeedingApi.middleware,
            explosiveFissionApi.middleware,
            keywordExplosionApi.middleware,
            morePlatformsApi.middleware,
            contentManageApi.middleware,
            videoPublishApi.middleware,
            videoAndPictrueApi.middleware,
            homeApi.middleware,
            homeCommonApi.middleware,
            myApi.middleware,
            ossApi.middleware,
        )
});

setupListeners(store.dispatch);

export default store;